<template>
	<m-layout title="详情" gap="24 0">
		<m-block v-if="Object.keys(newsObj).length" class="shop" spa="0 24 23" :isLoading='isPending' bgColor="unset">
			<view class="_header pb-24">
				<text class="fs34 fw-600">{{newsObj.title}}</text>
				<view class="">
					<text class="fs21 text-grey pr-8" v-if="newsObj.author&&newsObj.author.name">来源:{{newsObj.author.name}}</text>
					<text class="fs21 text-grey"  v-if="code!='zcxy'">{{newsObj.ctime | getDateDiff}}</text>
				</view>
			</view>
			<view class="_content fs26" v-html="newsObj.content">
				
			</view>
		</m-block>
	</m-layout>
</template>
<script>
	import { GetNewsInfo } from "@/api/News.js"
	export default {
		data() {
			return {
				isPending: true,
				newsObj: {},
				id: 1,
				code: '',
			};
		},
		onLoad({ id,code }) {
			this.id = id || '';
			this.code = code || '';
			this.init();
		},
		methods: {
			async init() {
				this.isPending = true;
				await this.sleep(0.5);
				await this.getData();
				this.isPending = false;
			},
			async getData() {
				this.newsObj = await GetNewsInfo({
					id: this.id,
					code: this.code,
				})
			},
		},
		onPullDownRefresh() {
			this.init();
		},
		onReachBottom() {
			// this.getData();
			console.log("触底了");
		},

	}
</script>

<style lang="scss">
	page {
		height: 100%;
	}
	._content{
		::v-deep img{
			margin: 16rpx 0rpx;
			width: 100%;
		}
		::v-deep p{
			font-size: 32rpx;
			color: rgba(0,0,0,1);
		}
	}
</style>
